#include "stdafx.h"
#include "mayashared.h"

bool mustUninitialize;

void InitMayaShared()
{
	HRESULT hres = CoInitialize(0);
	if(hres == S_OK)
		mustUninitialize = true;
	else if(hres == S_FALSE)
		mustUninitialize = false;
	else
		throw Exception("Couldn't initialize COM");
}

void FreeMayaShared()
{
	if(mustUninitialize)
		CoUninitialize();
}